CC = g++
CFLAGS =  -Wall -O2
LDLIBS =   -lpthread  -leastl

SOURCES = $(wildcard *.cpp)
OBJS = $(patsubst %.cpp, %.o, $(SOURCES))
HEADERS = $(wildcard *.h)

COMM_DIR = comm
SOURCES_COMM = $(wildcard $(COMM_DIR)/*.cpp)
OBJS_COMM = $(patsubst %.cpp, %.o, $(SOURCES_COMM))

INCLUDE = -I../include -L../src

TARGETS =test.exe


all : $(TARGETS)


.PHONY: all clean


%.o:%.cpp 
	$(CC) -c $(CFLAGS) $(CPPFLAGS)  $(INCLUDE) $^ -o $@

$(TARGETS): $(OBJS)
	@echo "sources_comm:" $(SOURCES_COMM)
	@echo "source : "$(SOURCES)
	@echo "objs : " $(OBJS)
	@echo "objs_comm "$(OBJS_COMM)
	$(CC) -o $(TARGETS)  $(OBJS) $(OBJS_COMM) $(INCLUDE)   $(LDLIBS)


clean :
	rm $(TARGETS) $(OBJS) $(OBJS_COMM)
